package net.bwie.realtime.jtp.Rpfunction;

import net.bwie.realtime.jtp.bean.Order;
import org.apache.flink.api.common.functions.AggregateFunction;

/**
 * 简介说明:
 *
 * @author: LiLi
 * @date: 2025/05/28 10:46:12
 * @version: 1.0
 */
public class ProvincePaymentWindowFunction
        implements AggregateFunction<Order, Double, Double> {

    @Override
    public Double createAccumulator() {
        return 0.0;
    }

    @Override
    public Double add(Order value, Double accumulator) {
        return accumulator + (value.getQuantity() * value.getPrice());
    }

    @Override
    public Double getResult(Double accumulator) {
        return accumulator;
    }

    @Override
    public Double merge(Double a, Double b) {
        return a + b;
    }
}